package com.wjk.kylin.mall.order.mq;

import com.alibaba.fastjson.JSON;
import com.wjk.kylin.mall.order.bo.OrderBO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;


@Slf4j
@Component
public class OrderHandler implements MyHandler {

    @Override
    public Boolean handler(MessageDTO msg) {
        boolean flag = false;
        try {
            log.info("OrderHandler-msg:{}", JSON.toJSONString(msg));
            String data = msg.getData();
            OrderBO orderBO = JSON.parseObject(data, OrderBO.class);
            log.info("OrderHandler-memberId:{}", orderBO.getMemberId());
            flag = true;
        } catch (Exception e) {
            log.error(e.getMessage());
        }

        return flag;
    }
}
